package cn.edu.wtu.wtr.media.object;

import lombok.Data;

import java.io.Serializable;

/**
 * @TableName user
 */
@Data
public class User implements Serializable {
    /**
     * @mbg.generated Sun Jan 31 14:22:53 CST 2021
     */
    private Integer id;

    /**
     * @mbg.generated Sun Jan 31 14:22:53 CST 2021
     */
    private String username;

    /**
     * @mbg.generated Sun Jan 31 14:22:53 CST 2021
     */
    private String password;

    /**
     * 名字
     *
     * @mbg.generated Sun Jan 31 14:22:53 CST 2021
     */
    private String name;

    /**
     * @mbg.generated Sun Jan 31 14:22:53 CST 2021
     */
    private String department="未知部门";

    /**
     * @mbg.generated Sun Jan 31 14:22:53 CST 2021
     */
    private String office = "未登录";

    /**
     * @mbg.generated Sun Jan 31 14:22:53 CST 2021
     */
    private String phone="保密";

    /**
     * @mbg.generated Sun Jan 31 14:22:53 CST 2021
     */
    private String QQ="保密";

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table user
     *
     * @mbg.generated Sun Jan 31 14:22:53 CST 2021
     */
    private static final long serialVersionUID = 1L;

    /**
     * @mbg.generated
     */
    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        User other = (User) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getUsername() == null ? other.getUsername() == null : this.getUsername().equals(other.getUsername()))
                && (this.getPassword() == null ? other.getPassword() == null : this.getPassword().equals(other.getPassword()))
                && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
                && (this.getDepartment() == null ? other.getDepartment() == null : this.getDepartment().equals(other.getDepartment()))
                && (this.getOffice() == null ? other.getOffice() == null : this.getOffice().equals(other.getOffice()))
                && (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone()))
                && (this.getQQ() == null ? other.getQQ() == null : this.getQQ().equals(other.getQQ()));
    }

    /**
     * @mbg.generated
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUsername() == null) ? 0 : getUsername().hashCode());
        result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getDepartment() == null) ? 0 : getDepartment().hashCode());
        result = prime * result + ((getOffice() == null) ? 0 : getOffice().hashCode());
        result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode());
        result = prime * result + ((getQQ() == null) ? 0 : getQQ().hashCode());
        return result;
    }

    /**
     * @mbg.generated
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", username=").append(username);
        sb.append(", password=").append(password);
        sb.append(", name=").append(name);
        sb.append(", department=").append(department);
        sb.append(", office=").append(office);
        sb.append(", phone=").append(phone);
        sb.append(", QQ=").append(QQ);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }

    /**
     * 获取当前用户的身份
     * @return 身份
     */
    public Office office() {
        try {
            return Office.valueOf(this.getOffice());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return Office.未登录;
    }
}